﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace zielonka.co.uk.extensions.system
{
    //  Description:	Determines if a type is static by checking if it's abstract, sealed, and has no public constructors.
    /*
        Type env = typeof(Environment);
        Type str = typeof(String);

        string result = String.Format("Env-> {0}  Str-> {1}", env.IsStatic(), str.IsStatic());

        Console.WriteLine(result);
        // Env-> True  Str-> False

     */

    public static partial class TypeExtensions
    {
        public static bool IsStatic(this Type t)
        {
            var c = t.GetConstructors();
            return (t.IsAbstract && t.IsSealed && c.Length == 0);
        }
    }
}
